//
//  UIView+ViewController.m
//  Pods
//
//  Created by quheng on 2017/8/29.
//
//

#import "UIView+ViewController.h"

@implementation UIView (ViewController)

- (UIViewController*)viewController{
    
    UIResponder *nextResponder =  self;
    do{
        nextResponder = [nextResponder nextResponder];
        
        if ([nextResponder isKindOfClass:[UIViewController class]])
            return (UIViewController*)nextResponder;
        
    } while (nextResponder != nil);
    
    return nil;
}
@end
